<?php

class Application_Model_Benutzer
{
	protected $_nr;
	protected $_passwort;
	protected $_name;
	protected $_vorname;
	protected $_status;

	public function __construct(array $options = null)
	{
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}

	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid article property');
		}
		$this->$method($value);
	}

	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid article property');
		}
		return $this->$method();
	}

	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function getNr(){
		return $this->_nr;
	}
	
	public function setNr($nr){
		$this->_nr=$nr;
		return $this;
	}
	
	public function setPasswort($passwort){
		//ueberprüfungen
		
		$this->_passwort=md5($passwort);
		return $this;
	}
	
	public function getPasswort(){
		return $this->_passwort;
	}
	
	public function setName($name){
		
		//ueberpruefung
		$this->_name =$name;
		return $this;
	}
	
	public function getName(){
		return $this->_name;
	}
	
	public function setVorname($vorname){
		//ueberpruefen
		$this->_vorname=$vorname;
		return $this;
	}
	
	public function getVorname(){
		return $this->_vorname;
	}
	
	public function setStatus($status){
		//ueberpruefen
		
		$this->_status=$status;
		return $this;
	}
	
	public function getStatus(){
		return $this->_status;
	}

}

